﻿<div class="bjui-pageHeader">
    <form id="pagerForm" data-toggle="ajaxsearch" action="${request.getContextPath()}/stepInOutYield/stepInOutYield" method="post">
        <div class="bjui-searchBar">
            <g:hiddenField name="SYS_QUERY_NAME" value="stepInOutYield" />
            <g:hiddenField name="EXPORT_CONTENT_NAME" value="Excel" />
            <label>扩散批号：</label>
            <input name="SUBSTRATE_ID1" value="${SUBSTRATE_ID1}" size="18"/>
            <label>组装批号：</label>
            <input name="LOT_ID" value="${LOT_ID}" size="18"/>

            <label>封装形式：</label>
            %{--<input name="RESERVED1" value="${RESERVED1}" size="18"/>--}%
            <g:select name="RESERVED1" from="${packageForm}" data-toggle="selectpicker" data-width="180" data-live-search="true" optionKey="RESERVED1" optionValue="RESERVED1" value="${RESERVED1}" noSelection="['':'--ALL--']" />&nbsp;
            <label>客户订单：</label>
            <input name="CUSTOMER_ORDER" value="${CUSTOMER_ORDER}" size="18"/>
            <br/>
            <label>产品名称：</label>
            <input name="PART_NAME" value="${PART_NAME}" size="18"/>
            <label>工&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;步：</label>
            <g:select name="STEP_NAME" from="${stepList}" data-toggle="selectpicker" data-width="180" data-live-search="true" optionKey="STEP_NAME" optionValue="STEP_DESC" value="${STEP_NAME}" noSelection="['':'--ALL--']" />&nbsp;
            <br/>
            <label>开始日期<strong><span class="text-danger">*</span></strong>：</label>
            <input type="text" name="startTime" class="form-control"
                   data-toggle="datepicker" data-pattern="yyyy-MM-dd"
                   size="18" id="start-date-input" readonly value="${startTime}">&nbsp;
            <label>结束日期<strong><span class="text-danger">*</span></strong>：</label>
            <input type="text" name="endTime" class="form-control"
                   data-toggle="datepicker" data-pattern="yyyy-MM-dd"
                   size="18" id="end-date-input" readonly value="${endTime.format('yyyy-MM-dd')}" >&nbsp;
            <button type="submit" class="btn-default" data-icon="search">查询</button>&nbsp;
            <button type="button" class="btn-blue" onclick="javascript:bjuiExportExl('#pagerForm','${request.getContextPath()}/stepInOutYield/exportExcel')" data-icon="file-excel-o" title="导出Excel">导出Excel文件</button>&nbsp;
        </div>
    </form>
</div>
<div class="bjui-pageContent">
<g:if test="${stepInOutYield.size()>0}">
    <div style="margin:15px auto 0; width:96%;">
        <div class="row" style="padding: 0 8px;">
            <div class="col-md-12">
                <div class="panel panel-default">
                    <div class="panel-heading">
                        <h3 class="panel-title"><i class="fa fa-line-chart fa-fw"></i>投入产出良率图</h3>
                    </div>
                    <div class="panel-body">
                        <div style="mini-width:400px;height:200px;" id="stepInOutYield"></div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <div  style="margin:15px auto 0; width:96%;">
        <div class="row" style="padding: 0 8px;">
            <div class="col-md-12" id="glassOutReportTable123">
                <g:if test="${stepInOutYield.size()>0}">
                    <table data-toggle="tablefixed" data-width="100%" data-nowrap="true">
                        <thead>
                        <tr>
                            <th width="50" align="center" rowspan="2">No.</th>
                            <th width="290" align="center" rowspan="2">工步</th>
                            <g:each in="${dayList}" status="i" var="dataInstance">
                            <th width="50" align="center" colspan="3">${dataInstance}</th>
                            </g:each>
                          <th width="250"  colspan="3" align="center">总计</th>
                        </tr>
                        <tr>
                            <g:each in="${dayList}" status="i" var="dataInstance">
                                <th width="70" align="center">投入数</th>
                                <th width="70" align="center">产出数</th>
                                <th width="70" align="center">良率</th>
                            </g:each>
                           <th width="70" align="center">投入数</th>
                            <th width="70" align="center">产出数</th>
                            <th width="70" align="center">良率</th>
                        </tr>
                        </thead>
                        <tbody>
                        <g:each in="${stepInOutYield1}" status="i" var="dataInstance">
                            <tr>
                                <td>${i+1}</td>
                                <td>${dataInstance.STEP_DESC}</td>
                                <g:each in="${dayList}" status="j" var="dataInstance1">
                                    <td>${dataInstance["${dataInstance1}~TRACK_IN_MAIN_QTY"]}</td>
                                    <td>${dataInstance["${dataInstance1}~TRACK_OUT_MAIN_QTY"]}</td>
                                    <g:if test="${dataInstance["${dataInstance1}~YIELD"]==null}">
                                        <td></td>
                                    </g:if>
                                    <g:else>
                                        <td>${dataInstance["${dataInstance1}~YIELD"]}%</td>
                                    </g:else>
                                </g:each>
                                <g:each in="${stepInOutYield2}" status="w" var="dataInstance4">
                                    <g:if test="${dataInstance.STEP_DESC==dataInstance4.STEP_DESC}">
                                    <td align="center" >${dataInstance4.TRACK_IN_MAIN_QTY}</td>
                                    <td align="center" >${dataInstance4.TRACK_OUT_MAIN_QTY}</td>
                                    <td align="center" >${dataInstance4.yield}%</td>
                                    </g:if>
                                </g:each>
                            </tr>
                        </g:each>
                        </tbody>
                    </table>
                </g:if>
            </div>
        </div>
    </div>
</div>
<g:if test="${params.STEP_NAME==null||params.STEP_NAME==''}">
    </g:if>
    <g:else>


<script src="${resource(dir: 'js/echarts', file: 'echarts.js')}" type="text/javascript"/>
<script src="${resource(dir: 'js/echarts', file: 'echarts-tool.js')}" type="text/javascript"/>



    <script type="text/javascript">
    // 基于准备好的dom，初始化echarts实例
    var contextPath = "${request.getContextPath()}";
    eChartsTool.init(contextPath);

    var xAxisData = [];
        <g:each in="${dayList}">
            xAxisData.push('${it}');
        </g:each>
    var data1=[];

            <g:each in="${INData}" >
                    data1.push('${it}');
            </g:each>

    var data2=[];
    <g:each in="${OUTData}" >
    data2.push('${it}');
    </g:each>
    var data3=[];
    <g:each in="${YIELDData}" >
    data3.push('${it}');
    </g:each>
    // 指定图表的配置项和数据
    var option = {
        title: {
            text: ''
        },
        tooltip: {},
        legend: {
            data:['投入','产出','良率']

        },
        grid: {
            left: '3%',
            right: '4%',
            bottom: '3%',
            containLabel: true
        },
        xAxis: {
            "axisLabel":{
                "interval":0,
                "rotate":45,
            },
            data:xAxisData

        },
        yAxis:[ { axisLabel: {
            formatter: '{value} K'
        }},
            { axisLabel: {
                formatter: '{value} %'
            }}
        ],
        series: [

            { name: '投入',
                type: 'bar',
                itemStyle:{  normal:{color:'rgb(255,255,0)'}   },
                data:data1
            }
            ,
            { name: '产出',
                type: 'bar',
                itemStyle:{  normal:{color:'rgb(0,255,0)'}   },
                data:data2
            },
            { name: '良率',
                type: 'line',
                itemStyle:{  normal:{color:'rgb(255,0,0)'}   },
                yAxisIndex: 1,
                data:data3
            }
            ],
        label: {
            normal: {
                show: true,
                position: 'top'
            }
        }
    };

    // 使用刚指定的配置项和数据显示图表。
    eChartsTool.setOption("roma", document.getElementById('stepInOutYield'), option);

</script>
    </g:else>
</g:if>